package com.fit.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.fit.interfaces.ServiceI;
@Component
public class ServicesBean implements ServicesI {

	private Map<String, ServiceI> services;

	public ServicesBean() {
		this.services = new HashMap<String, ServiceI>();
	}

	public ServicesBean(Map<String, ServiceI> services) {
		super();
		this.services = services;
	}
	
	/* (non-Javadoc)
	 * @see com.fit.service.ServicesI#save(com.fit.interfaces.ServiceI)
	 */
	public ServiceI save(ServiceI service){
		return services.put(service.getDescription(), service);
	}
	/* (non-Javadoc)
	 * @see com.fit.service.ServicesI#retrive()
	 */
	public Collection<ServiceI> retrive(){
		return services.values();
	}
	
	public ServiceI retriveSingleService(Serializable id){
		return services.get(id);
	}
	
	public ServiceI editSingleService(ServiceI service){
		return services.put(service.getDescription(), service);
	}
	
	
}
